/**
 * Copyright(c) 2014 Xunton Solutions
 *
 * History:
 *   15-1-17 下午4:03 Created by dwzhang
 */
package com.jade.modules.template;

import java.util.Date;
import javax.persistence.*;

import com.jade.modules.cms.CmsEntity;

/**
 * 内容模版。
 *
 * @author <a href="mailto:dwzhang@xunton.com">dwzhang</a> 
 * @version 1.0 15-1-17 下午4:03
 */
//@Entity
//@Table (name = "MODULE_TEMPLATE")
public class Template
{
    public static final int STATUS_NORMAL = 0;
    public static final int STATUS_PAUSED = 1;

    @Id
    @GeneratedValue (generator = "SEQ_MODULE_TEMPLATE")
    @SequenceGenerator (name = "SEQ_MODULE_TEMPLATE", initialValue = 100, sequenceName = "SEQ_MODULE_TEMPLATE")
    private long id;
    //所有者类型
    @Column (name = "owner_type", nullable = false, updatable = false, length = 32)
    private String ownerType;
    //所有者
    @Column (name = "owner_id", nullable = false, updatable = false, length = 64)
    private String ownerId;
    //模板类型,例如短信模板、邮件模板、协议模板等等
    @Column (name = "type", nullable = false, length = 32)
    private String type;
    //模板业务类型
    @Column (name = "business_type", nullable = false, length = 32)
    private String businessType;
    //名称
    @Column (name = "name", nullable = false, length = 32)
    private String name;
    //状态，具体实体有自己的定义
    @Column (name = "status", nullable = false)
    private int status = STATUS_NORMAL;
    //说明信息，对于内容来说为摘要信息
    @Column (name = "remark", length = 256)
    private String remark;
    //主题信息，对于像邮件这类的模板有意义
    @Column (name = "title", length = 64)
    private String title;
    //是否能够被直接使用，如果否，仅用于被其他模版引用
    @Column (name = "root")
    private boolean root = true;
    //排序码
    @Column (name = "sort_code", nullable = false)
    protected int sortCode = 100;
    //创建日期
    @Column (name = "creation_date", nullable = false, updatable = false)
    protected Date creationDate;
    //修改日期
    @Column (name = "update_date")
    protected Date updateDate;
    //模版内容
    @Lob
    @Column (name = "content", nullable = false)
    private String content;

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getOwnerType()
    {
        return ownerType;
    }

    public void setOwnerType(String ownerType)
    {
        this.ownerType = ownerType;
    }

    public String getOwnerId()
    {
        return ownerId;
    }

    public void setOwnerId(String ownerId)
    {
        this.ownerId = ownerId;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getBusinessType()
    {
        return businessType;
    }

    public void setBusinessType(String businessType)
    {
        this.businessType = businessType;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public int getStatus()
    {
        return status;
    }

    public void setStatus(int status)
    {
        this.status = status;
    }

    public String getRemark()
    {
        return remark;
    }

    public void setRemark(String remark)
    {
        this.remark = remark;
    }

    public int getSortCode()
    {
        return sortCode;
    }

    public void setSortCode(int sortCode)
    {
        this.sortCode = sortCode;
    }

    public boolean isRoot()
    {
        return root;
    }

    public void setRoot(boolean root)
    {
        this.root = root;
    }

    public String getTitle()
    {
        return title;
    }

    public void setTitle(String title)
    {
        this.title = title;
    }

    public Date getCreationDate()
    {
        return creationDate;
    }

    public void setCreationDate(Date creationDate)
    {
        this.creationDate = creationDate;
    }

    public Date getUpdateDate()
    {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate)
    {
        this.updateDate = updateDate;
    }

    public String getContent()
    {
        return content;
    }

    public void setContent(String content)
    {
        this.content = content;
    }
}
